package com.zjx.springcloud.service.dept;

import com.zjx.springcloud.constant.HttpCode;
import com.zjx.springcloud.entities.ResultVO;
import com.zjx.springcloud.entities.test.Test;
import com.zjx.springcloud.utils.LanguageUtils;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;



@Component
public class DeptClientFallbackFactory implements FallbackFactory<DeptClientService> {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Override
    public DeptClientService create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public ResultVO queryAll(Test dept) {
                logger.error(this.getClass().getName()+":"+throwable.getMessage());
                System.out.println("****doError"+throwable.getMessage());

                    return new ResultVO(HttpCode.REQUEST_ERROR_CODE, LanguageUtils.getDefaultText("request_error"));
            }
        };
    }
}
